\(\int (3+b \sin (e+f x))^2 (c+d \sin (e+f x)) \, dx\) [680]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 99 \[ \int (3+b \sin (e+f x))^2 (c+d \sin (e+f x)) \, dx=\frac {1}{2} \left (18 c+b^2 c+6 b d\right ) x-\frac {2 \left (9 b c+9 d+b^2 d\right ) \cos (e+f x)}{3 f}-\frac {b (3 b c+6 d) \cos (e+f x) \sin (e+f x)}{6 f}-\frac {d \cos (e+f x) (3+b \sin (e+f x))^2}{3 f} \]

[Out]

1/2*(2*a^2*c+2*a*b*d+b^2*c)*x-2/3*(a^2*d+3*a*b*c+b^2*d)*cos(f*x+e)/f-1/6*b*(2*a*d+3*b*c)*cos(f*x+e)*sin(f*x+e)
/f-1/3*d*cos(f*x+e)*(a+b*sin(f*x+e))^2/f

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.08, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.087, Rules used = {2832, 2813} \[ \int (3+b \sin (e+f x))^2 (c+d \sin (e+f x)) \, dx=-\frac {2 \left (a^2 d+3 a b c+b^2 d\right ) \cos (e+f x)}{3 f}+\frac {1}{2} x \left (2 a^2 c+2 a b d+b^2 c\right )-\frac {b (2 a d+3 b c) \sin (e+f x) \cos (e+f x)}{6 f}-\frac {d \cos (e+f x) (a+b \sin (e+f x))^2}{3 f} \]

[In]

Int[(a + b*Sin[e + f*x])^2*(c + d*Sin[e + f*x]),x]

[Out]

((2*a^2*c + b^2*c + 2*a*b*d)*x)/2 - (2*(3*a*b*c + a^2*d + b^2*d)*Cos[e + f*x])/(3*f) - (b*(3*b*c + 2*a*d)*Cos[
e + f*x]*Sin[e + f*x])/(6*f) - (d*Cos[e + f*x]*(a + b*Sin[e + f*x])^2)/(3*f)

Rule 2813

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(2*a*c +
 b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Cos[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /;
 FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rule 2832

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-d
)*Cos[e + f*x]*((a + b*Sin[e + f*x])^m/(f*(m + 1))), x] + Dist[1/(m + 1), Int[(a + b*Sin[e + f*x])^(m - 1)*Sim
p[b*d*m + a*c*(m + 1) + (a*d*m + b*c*(m + 1))*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[
b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 0] && IntegerQ[2*m]

Rubi steps \begin{align*} \text {integral}& = -\frac {d \cos (e+f x) (a+b \sin (e+f x))^2}{3 f}+\frac {1}{3} \int (a+b \sin (e+f x)) (3 a c+2 b d+(3 b c+2 a d) \sin (e+f x)) \, dx \\ & = \frac {1}{2} \left (2 a^2 c+b^2 c+2 a b d\right ) x-\frac {2 \left (3 a b c+a^2 d+b^2 d\right ) \cos (e+f x)}{3 f}-\frac {b (3 b c+2 a d) \cos (e+f x) \sin (e+f x)}{6 f}-\frac {d \cos (e+f x) (a+b \sin (e+f x))^2}{3 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.82 (sec) , antiderivative size = 79, normalized size of antiderivative = 0.80 \[ \int (3+b \sin (e+f x))^2 (c+d \sin (e+f x)) \, dx=\frac {6 \left (\left (18+b^2\right ) c+6 b d\right ) (e+f x)-9 \left (8 b c+12 d+b^2 d\right ) \cos (e+f x)+b^2 d \cos (3 (e+f x))-3 b (b c+6 d) \sin (2 (e+f x))}{12 f} \]

[In]

Integrate[(3 + b*Sin[e + f*x])^2*(c + d*Sin[e + f*x]),x]

[Out]

(6*((18 + b^2)*c + 6*b*d)*(e + f*x) - 9*(8*b*c + 12*d + b^2*d)*Cos[e + f*x] + b^2*d*Cos[3*(e + f*x)] - 3*b*(b*
c + 6*d)*Sin[2*(e + f*x)])/(12*f)

Maple [A] (verified)

Time = 1.81 (sec) , antiderivative size = 92, normalized size of antiderivative = 0.93

method result size
parts \(a^{2} c x +\frac {\left (2 a b d +b^{2} c \right ) \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}-\frac {\left (a^{2} d +2 a b c \right ) \cos \left (f x +e \right )}{f}-\frac {b^{2} d \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3 f}\) \(92\)
parallelrisch \(\frac {\left (-6 a b d -3 b^{2} c \right ) \sin \left (2 f x +2 e \right )+b^{2} d \cos \left (3 f x +3 e \right )+\left (-12 a^{2} d -24 a b c -9 b^{2} d \right ) \cos \left (f x +e \right )+\left (6 f x c -8 d \right ) b^{2}-24 \left (-\frac {d x f}{2}+c \right ) a b +12 a^{2} \left (f x c -d \right )}{12 f}\) \(105\)
derivativedivides \(\frac {a^{2} c \left (f x +e \right )-a^{2} d \cos \left (f x +e \right )-2 a b c \cos \left (f x +e \right )+2 a b d \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+b^{2} c \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {b^{2} d \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3}}{f}\) \(115\)
default \(\frac {a^{2} c \left (f x +e \right )-a^{2} d \cos \left (f x +e \right )-2 a b c \cos \left (f x +e \right )+2 a b d \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )+b^{2} c \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {b^{2} d \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3}}{f}\) \(115\)
risch \(a^{2} c x +a b d x +\frac {x \,b^{2} c}{2}-\frac {\cos \left (f x +e \right ) a^{2} d}{f}-\frac {2 \cos \left (f x +e \right ) a b c}{f}-\frac {3 \cos \left (f x +e \right ) b^{2} d}{4 f}+\frac {b^{2} d \cos \left (3 f x +3 e \right )}{12 f}-\frac {\sin \left (2 f x +2 e \right ) a b d}{2 f}-\frac {\sin \left (2 f x +2 e \right ) b^{2} c}{4 f}\) \(117\)
norman \(\frac {\left (a^{2} c +a b d +\frac {1}{2} b^{2} c \right ) x +\left (a^{2} c +a b d +\frac {1}{2} b^{2} c \right ) x \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (3 a^{2} c +3 a b d +\frac {3}{2} b^{2} c \right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (3 a^{2} c +3 a b d +\frac {3}{2} b^{2} c \right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\frac {b \left (2 d a +c b \right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {6 a^{2} d +12 a b c +4 b^{2} d}{3 f}-\frac {\left (2 a^{2} d +4 a b c \right ) \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {\left (4 a^{2} d +8 a b c +4 b^{2} d \right ) \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {b \left (2 d a +c b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{3}}\) \(259\)

[In]

int((a+b*sin(f*x+e))^2*(c+d*sin(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

a^2*c*x+(2*a*b*d+b^2*c)/f*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)-(a^2*d+2*a*b*c)/f*cos(f*x+e)-1/3*b^2*d/f*
(2+sin(f*x+e)^2)*cos(f*x+e)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 89, normalized size of antiderivative = 0.90 \[ \int (3+b \sin (e+f x))^2 (c+d \sin (e+f x)) \, dx=\frac {2 \, b^{2} d \cos \left (f x + e\right )^{3} + 3 \, {\left (2 \, a b d + {\left (2 \, a^{2} + b^{2}\right )} c\right )} f x - 3 \, {\left (b^{2} c + 2 \, a b d\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) - 6 \, {\left (2 \, a b c + {\left (a^{2} + b^{2}\right )} d\right )} \cos \left (f x + e\right )}{6 \, f} \]

[In]

integrate((a+b*sin(f*x+e))^2*(c+d*sin(f*x+e)),x, algorithm="fricas")

[Out]

1/6*(2*b^2*d*cos(f*x + e)^3 + 3*(2*a*b*d + (2*a^2 + b^2)*c)*f*x - 3*(b^2*c + 2*a*b*d)*cos(f*x + e)*sin(f*x + e
) - 6*(2*a*b*c + (a^2 + b^2)*d)*cos(f*x + e))/f

Sympy [A] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 199, normalized size of antiderivative = 2.01 \[ \int (3+b \sin (e+f x))^2 (c+d \sin (e+f x)) \, dx=\begin {cases} a^{2} c x - \frac {a^{2} d \cos {\left (e + f x \right )}}{f} - \frac {2 a b c \cos {\left (e + f x \right )}}{f} + a b d x \sin ^{2}{\left (e + f x \right )} + a b d x \cos ^{2}{\left (e + f x \right )} - \frac {a b d \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} + \frac {b^{2} c x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {b^{2} c x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {b^{2} c \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {b^{2} d \sin ^{2}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {2 b^{2} d \cos ^{3}{\left (e + f x \right )}}{3 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin {\left (e \right )}\right )^{2} \left (c + d \sin {\left (e \right )}\right ) & \text {otherwise} \end {cases} \]

[In]

integrate((a+b*sin(f*x+e))**2*(c+d*sin(f*x+e)),x)

[Out]

Piecewise((a**2*c*x - a**2*d*cos(e + f*x)/f - 2*a*b*c*cos(e + f*x)/f + a*b*d*x*sin(e + f*x)**2 + a*b*d*x*cos(e
 + f*x)**2 - a*b*d*sin(e + f*x)*cos(e + f*x)/f + b**2*c*x*sin(e + f*x)**2/2 + b**2*c*x*cos(e + f*x)**2/2 - b**
2*c*sin(e + f*x)*cos(e + f*x)/(2*f) - b**2*d*sin(e + f*x)**2*cos(e + f*x)/f - 2*b**2*d*cos(e + f*x)**3/(3*f),
Ne(f, 0)), (x*(a + b*sin(e))**2*(c + d*sin(e)), True))

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.13 \[ \int (3+b \sin (e+f x))^2 (c+d \sin (e+f x)) \, dx=\frac {12 \, {\left (f x + e\right )} a^{2} c + 3 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2} c + 6 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a b d + 4 \, {\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} b^{2} d - 24 \, a b c \cos \left (f x + e\right ) - 12 \, a^{2} d \cos \left (f x + e\right )}{12 \, f} \]

[In]

integrate((a+b*sin(f*x+e))^2*(c+d*sin(f*x+e)),x, algorithm="maxima")

[Out]

1/12*(12*(f*x + e)*a^2*c + 3*(2*f*x + 2*e - sin(2*f*x + 2*e))*b^2*c + 6*(2*f*x + 2*e - sin(2*f*x + 2*e))*a*b*d
 + 4*(cos(f*x + e)^3 - 3*cos(f*x + e))*b^2*d - 24*a*b*c*cos(f*x + e) - 12*a^2*d*cos(f*x + e))/f

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 93, normalized size of antiderivative = 0.94 \[ \int (3+b \sin (e+f x))^2 (c+d \sin (e+f x)) \, dx=\frac {b^{2} d \cos \left (3 \, f x + 3 \, e\right )}{12 \, f} + \frac {1}{2} \, {\left (2 \, a^{2} c + b^{2} c + 2 \, a b d\right )} x - \frac {{\left (8 \, a b c + 4 \, a^{2} d + 3 \, b^{2} d\right )} \cos \left (f x + e\right )}{4 \, f} - \frac {{\left (b^{2} c + 2 \, a b d\right )} \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} \]

[In]

integrate((a+b*sin(f*x+e))^2*(c+d*sin(f*x+e)),x, algorithm="giac")

[Out]

1/12*b^2*d*cos(3*f*x + 3*e)/f + 1/2*(2*a^2*c + b^2*c + 2*a*b*d)*x - 1/4*(8*a*b*c + 4*a^2*d + 3*b^2*d)*cos(f*x
+ e)/f - 1/4*(b^2*c + 2*a*b*d)*sin(2*f*x + 2*e)/f

Mupad [B] (verification not implemented)

Time = 8.08 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.09 \[ \int (3+b \sin (e+f x))^2 (c+d \sin (e+f x)) \, dx=-\frac {\frac {3\,b^2\,c\,\sin \left (2\,e+2\,f\,x\right )}{2}-\frac {b^2\,d\,\cos \left (3\,e+3\,f\,x\right )}{2}+6\,a^2\,d\,\cos \left (e+f\,x\right )+\frac {9\,b^2\,d\,\cos \left (e+f\,x\right )}{2}+3\,a\,b\,d\,\sin \left (2\,e+2\,f\,x\right )-6\,a^2\,c\,f\,x-3\,b^2\,c\,f\,x+12\,a\,b\,c\,\cos \left (e+f\,x\right )-6\,a\,b\,d\,f\,x}{6\,f} \]

[In]

int((a + b*sin(e + f*x))^2*(c + d*sin(e + f*x)),x)

[Out]

-((3*b^2*c*sin(2*e + 2*f*x))/2 - (b^2*d*cos(3*e + 3*f*x))/2 + 6*a^2*d*cos(e + f*x) + (9*b^2*d*cos(e + f*x))/2
+ 3*a*b*d*sin(2*e + 2*f*x) - 6*a^2*c*f*x - 3*b^2*c*f*x + 12*a*b*c*cos(e + f*x) - 6*a*b*d*f*x)/(6*f)